package psico_test.gui;

import psico_test.psicoTest;
import psico_test.appAdministrar.appAdministrar;
import psico_test.appAdministrar.gui.ventanaAdministrar;
import psico_test.appCrear.appCrear;
import psico_test.appCrear.gui.ventanaCrear;
import psico_test.appEjecutar.appEjecutar;
import psico_test.appEjecutar.gui.ventanaEjecutar;
import psico_test.users.Cliente;
import psico_test.users.Usuario;

public class ventanaMenu extends javax.swing.JFrame implements Runnable
{	
	private psicoTest controller;

	public ventanaMenu(psicoTest controller)
	{
		this.controller = controller;
	}

	private void initComponents() 
	{

		PanelFondo = new org.edisoncor.gui.panel.PanelImageReflect();
		PanelBotones = new javax.swing.JPanel();
		BotonNuevoExperimento = new org.edisoncor.gui.button.ButtonTask();
		BotonEjecutar = new org.edisoncor.gui.button.ButtonTask();
		BotonAdministrar = new org.edisoncor.gui.button.ButtonTask();
		BotonExit = new org.edisoncor.gui.button.ButtonIcon();

		setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);

		PanelFondo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/reloj2.png"))); // NOI18N

		org.jdesktop.layout.GroupLayout PanelFondoLayout = new org.jdesktop.layout.GroupLayout(PanelFondo);
		PanelFondo.setLayout(PanelFondoLayout);
		PanelFondoLayout.setHorizontalGroup(
				PanelFondoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
				.add(0, 206, Short.MAX_VALUE)
		);
		PanelFondoLayout.setVerticalGroup(
				PanelFondoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
				.add(0, 278, Short.MAX_VALUE)
		);

		BotonNuevoExperimento.setText("Nuevo");
		BotonNuevoExperimento.setDescription("Creación de nuevos experimentos");
		BotonNuevoExperimento.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				NuevoExperimento(evt);
			}
		});

		BotonEjecutar.setText("Ejecutar");
		BotonEjecutar.setDescription("Ejecución de experimentos ya creados");
		BotonEjecutar.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				EjecutarExperimento(evt);
			}
		});

		BotonAdministrar.setText("Administrar");
		BotonAdministrar.setDescription("Administración de usuarios");
		BotonAdministrar.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				Administrar(evt);
			}
		});

		BotonExit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/exit.png"))); // NOI18N
		BotonExit.setText("buttonIcon1");
		BotonExit.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				Salir(evt);
			}
		});

		org.jdesktop.layout.GroupLayout PanelBotonesLayout = new org.jdesktop.layout.GroupLayout(PanelBotones);
		PanelBotones.setLayout(PanelBotonesLayout);
		PanelBotonesLayout.setHorizontalGroup(
				PanelBotonesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
				.add(org.jdesktop.layout.GroupLayout.TRAILING, PanelBotonesLayout.createSequentialGroup()
						.addContainerGap()
						.add(PanelBotonesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
								.add(org.jdesktop.layout.GroupLayout.LEADING, BotonEjecutar, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE)
								.add(org.jdesktop.layout.GroupLayout.LEADING, PanelBotonesLayout.createSequentialGroup()
										.add(PanelBotonesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
												.add(org.jdesktop.layout.GroupLayout.LEADING, BotonAdministrar, 0, 0, Short.MAX_VALUE)
												.add(org.jdesktop.layout.GroupLayout.LEADING, BotonNuevoExperimento, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 321, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
												.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
												.add(BotonExit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 49, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
												.addContainerGap())
		);
		PanelBotonesLayout.setVerticalGroup(
				PanelBotonesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
				.add(PanelBotonesLayout.createSequentialGroup()
						.addContainerGap()
						.add(BotonNuevoExperimento, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
						.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
						.add(BotonEjecutar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
						.add(PanelBotonesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
								.add(PanelBotonesLayout.createSequentialGroup()
										.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
										.add(BotonAdministrar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
										.add(PanelBotonesLayout.createSequentialGroup()
												.add(64, 64, 64)
												.add(BotonExit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 48, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
												.addContainerGap(14, Short.MAX_VALUE))
		);

		org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
		getContentPane().setLayout(layout);
		layout.setHorizontalGroup(
				layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
				.add(layout.createSequentialGroup()
						.add(PanelFondo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
						.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
						.add(PanelBotones, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
		);
		layout.setVerticalGroup(
				layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
				.add(PanelBotones, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
				.add(PanelFondo, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
		);
		addWindowListener(new java.awt.event.WindowAdapter()
		{
			public void windowClosing(java.awt.event.WindowEvent evt)
			{
				Salir(null);
			}
		}
		);
		pack();
	}

	public void run() 
	{
		initComponents();
		setTitle("Psico-Test");
		setLocationRelativeTo(null);
		setResizable(false);
		setVisible(true);
	}

	private void NuevoExperimento(java.awt.event.ActionEvent evt) 
	{
		controller.initAppCrear();
	}

	private void EjecutarExperimento(java.awt.event.ActionEvent evt) 
	{
		controller.initAppEjecutar();
	}

	private void Administrar(java.awt.event.ActionEvent evt) 
	{
		controller.initAppAdministrar();
	}

	private void Salir(java.awt.event.ActionEvent evt) 
	{
		this.dispose();
		this.controller.stopPsicoTest();
	}

	private org.edisoncor.gui.button.ButtonTask BotonAdministrar;
	private org.edisoncor.gui.button.ButtonTask BotonEjecutar;
	private org.edisoncor.gui.button.ButtonIcon BotonExit;
	private org.edisoncor.gui.button.ButtonTask BotonNuevoExperimento;
	private javax.swing.JPanel PanelBotones;
	private org.edisoncor.gui.panel.PanelImageReflect PanelFondo;


	public static void main(String[]args)
	{
		new ventanaMenu(null).setVisible(true);
	}
}
